package com.example.blog.module.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * <p>
 * 
 * </p>
 *
 * @author zjx
 * @since 2022-11-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("ms_article")
@Document(indexName = "article")
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 一定要记得加 要不然 会出现精度损失
     * @JsonSerialize(using = ToStringSerializer.class)
     */
    @Id
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 评论数量
     */
    @Field(type = FieldType.Integer)
    private Integer commentCounts;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.basic_date_time)
    private LocalDateTime createDate;

    /**
     * 简介
     */
    @Field(type = FieldType.Text)
    private String summary;

    /**
     * 标题
     */
    @Field(type = FieldType.Text)
    private String title;

    /**
     * 浏览数量
     */
    @Field(type = FieldType.Integer)
    private Integer viewCounts;

    /**
     * 是否置顶
     */
    @Field(type = FieldType.Integer)
    private Integer weight;

    /**
     * 作者id
     */
    @Field(type = FieldType.Long)
    private Long authorId;

    /**
     * 类别id
     */
    @Field(type = FieldType.Long)
    private Long categoryId;

    /**
     * 文章内容
     */
    @Field(type = FieldType.Text)
    private String content;

    /**
     *
     */
    @Field(type = FieldType.Text)
    private String contentHtml;

    /**
     * 热度
     */
    @Field(type = FieldType.Double)
    private Double hotness;

}
